var http = require("http");
var express = require("express")
var app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.json()); //数据JSON类型
app.use(bodyParser.urlencoded({ extended: false })); //解析post请求数据
//var server = http.createServer();
// server.on("request",function(request,response){
//     response.write("[{'id':1,name:'张三'},{'id':2,name:'李四'}]")
//     response.end();
// });

app.post("/api/user/login", function(req, res) {
    res.setHeader("Content-Type", "text/json;charset=utf-8")
    console.log(req.body.UserName)
    res.end(JSON.stringify('{"name":"海绵宝宝","id":"1002","phone":"17693151456"}'))
})


let server = app.listen(8888, function() {
    console.log("服务器启动成功 http://%s:%s", server.address().address, server.address().port)
})